<title>PC端banner</title>
<div class="layui-fluid upManager">
    <div class="layui-row">

        <div class="layui-col-md12">

            <div class="layui-card">
                <div class="layui-card-body">
                    <button class="layui-btn layui-btn-sm" data-type="">
                        增加banner
                    </button>
                    <hr>
                    <table class="layui-table" id="upEle" lay-filter="up">
                    </table>
                </div>
            </div>
        </div>

    </div>
</div>


<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="view">编辑</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>


<script>
    layui.use(['admin', 'table', 'upload'], function () {
        var table = layui.table,
            upload = layui.upload,
            admin = layui.admin;
        var $ = layui.$;

        table.render({
            elem: '#upEle',
            url: './json/settings/pcbanner.js',
            id: 'up',
            page: 'true',
            cols: [[
                {field: 'pic', title: '图片', templet : function (d) {
                        return "<image src='" + d.pic + "' style='height:30px;'></image>";
                    }},
                {field: 'link', title: '链接'},
                {fixed: 'right', align: 'center', toolbar: '#barDemo', width: 240}
            ]]
        });

        //监听工具条
        table.on('tool(up)', function (obj) {
            var data = obj.data;

            if (obj.event === 'view') {

                location.hash = '/settings/uploadBanner/id=' + data.id;

            } else if (obj.event === 'ban') {
                layer.msg('确认删除？', {icon: 1});
            } else if (obj.event === 'del') {
                layer.confirm('您是如何看确认删除待前端开发？', {
                    btn: ['确认','取消'] //按钮
                }, function(){
                    //确认
                    layer.msg('删除成功', {icon: 1});
                }, function(){

                });
            }

        });



    });
</script>